#include "comm.hpp"

int main()
{
    printf("key: 0x%x\n", Get_Key());
    printf("shmid: %d\n", GetShm());
    
    //挂接
    int shmid = GetShm();
    char* shmaddr = (char*)shmat(shmid, nullptr, 0); //第三个参数默认读写
    // if(shmaddr == (void*)-1)
    // {
    //     perror("processb::main::shmaddr");
    //     return -1;
    // }

    while(true)
    {
        std::cout << "processb say@ ";
        std::cout << shmaddr << std::endl;
        sleep(1);
    }
    //打开文件
    // int fd = open(PATHNAME.c_str(), O_RDONLY);
    // if(fd < 0)
    // {
    //     perror("processa.cpp::main::open");
    //     return 1;
    // }

    // while(true)
    // {
    //     ssize_t s = read(fd, );
    // }
    shmdt(shmaddr);
    

    return 0;
}